/*
 * AddressManagerListItem.java
 * business
 *
 * Created by SunDing on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.displaylistitem;

import android.content.Context;
import android.view.View;

import com.yidiandao.business.data.bean.FileTraversal;
import com.yidiandao.business.ui.widget.listview.DisplayListItem;
import com.yidiandao.business.ui.widget.listview.viewholder.ChooseLocalPicturePopHolder;
import com.yidiandao.business.utils.ImageLoader;

import java.util.List;

/** 选择本地图片 */
public class ChooseLocalPicturePopListItem
        extends DisplayListItem<ChooseLocalPicturePopHolder, FileTraversal> {

    public ChooseLocalPicturePopListItem(FileTraversal s) {
        super(s);
    }

    @Override
    public void onShow(final Context context, final ChooseLocalPicturePopHolder holder) {
        holder.mFilenameTextview.setText(data.filename);
        List<String> filecontent = data.filecontent;
        holder.mFilecountTextview.setText(filecontent.size() + "张");

        ImageLoader.loadImage(context, holder.mFilephotoImgview, filecontent.get(0));

        holder.mIvStatus.setVisibility(data.isSelected == 1 ? View.VISIBLE : View.GONE);
    }

    @Override
    public String getDisplayItemTag() {
        return ChooseLocalPicturePopListItem.class.getSimpleName();
    }

    @Override
    public Class<ChooseLocalPicturePopHolder> getViewHolderClazz() {
        return ChooseLocalPicturePopHolder.class;
    }
}
